package com.smh.a01ObjcesDemo1;

import java.util.Objects;

public class Test {
    public static void main(String[] args) {
        Object obj = null;
        Object obj1 = new Object();
        //null不能调用方法
        //System.out.println(obj.equals(obj1));
        System.out.println(Objects.equals(obj1,obj));
        //他会先判断是否为null,若为空返回false,否则你调用equals

    }
}
